<!DOCTYPE html>
<html lang="en">
<head>
    <!-- Use correct character set. -->
    <meta charset="utf-8">
    <!-- Tell IE to use the latest, best version. -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- Make the application on mobile take up the full browser screen and disable user scaling. -->
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
    <title>Hello World!</title>
    <script src="./js/Cesium.js"></script>
    <style>
        @import url(./css/widgets.css);
        html, body, #cesiumContainer {
            width: 100%; height: 100%; margin: 0; padding: 0; overflow: hidden;
        }

    </style>
</head>
<body>
<div id="cesiumContainer"></div>

<script>
    Cesium.Ion.defaultAccessToken='你的token';
    var viewer = new Cesium.Viewer('cesiumContainer',{
        imageryProvider : Cesium.createOpenStreetMapImageryProvider({
            url : 'https://a.tile.openstreetmap.org/'
        }),
        showRenderLoopErrors : false,
        shouldAnimate : true
    });

    //粒子系统的起点，发射源
    var staticPosition = Cesium.Cartesian3.fromDegrees(116.34516786934411,39.99753297677145,3.614538127977399);
    var entity44 = viewer.entities.add({
        position : staticPosition
    });
    function computeModelMatrix(entity, time) {
        var position = Cesium.Property.getValueOrUndefined(entity.position);
        let modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(position);
        return modelMatrix;
    }
    function computeEmitterModelMatrix() {
        let  hpr = Cesium.HeadingPitchRoll.fromDegrees(0, 0, 0);
        let trs = new Cesium.TranslationRotationScale();
        trs.translation = Cesium.Cartesian3.fromElements(2.5,4, 1);
        trs.rotation = Cesium.Quaternion.fromHeadingPitchRoll(hpr);
        let result=Cesium.Matrix4.fromTranslationRotationScale(trs);
        return result
    }

    viewer.scene.primitives.add(new Cesium.ParticleSystem({
        image : './img/fire.png',
        startColor : Cesium.Color.RED.withAlpha(0.7),
        endColor : Cesium.Color.YELLOW.withAlpha(0.3),
        startScale : 0,
        endScale : 10,
        //设定粒子寿命可能持续时间的最小限值(以秒为单位)，在此限值之上将随机选择粒子的实际寿命。
        minimumParticleLife : 1,
        maximumParticleLife : 6,
        minimumSpeed :1,
        maximumSpeed : 4,
        imageSize : new Cesium.Cartesian2(55, 55),
        // Particles per second.
        emissionRate : 4,
        lifetime : 160.0,
        // emitter : new Cesium.CircleEmitter(5.0),
        emitter : new Cesium.ConeEmitter(Cesium.Math.toRadians(45.0)),
        modelMatrix : computeModelMatrix(entity44, Cesium.JulianDate.now()),
        emitterModelMatrix : computeEmitterModelMatrix()

    }));


    viewer.camera.setView({
        destination : Cesium.Cartesian3.fromDegrees(116.34516786934411,39.99753297677145, 50.0)
    });


</script>


</body>
<script ></script>
</html>
